home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1997 March / Software of the Month Club 1997 March.iso / mac / Utilities / SoftwareFPU 3.03 / SoftwareFPU Documentation / Programmer Info / Programmer Info (.txt)
Encoding:
Common Ground  |  1995-02-19  |  15.6 KB  |  116 lines  |  [CGDC/CGVM]

  1. Times
  2. John Neil & Associates
  3. P.O. Box 2156
  4. Cupertino, CA 95015  USA
  5. Orders:
  6. E-Mail:
  7. (800) 663-2943
  8. (415) 661-2944
  9. johnneil@netcom.com
  10. lUUUU
  11. HUUUU
  12. I$UUUU
  13. ------
  14. <<<<<<
  15. KKKKKK
  16. ZZZZZZ
  17. iiiiii
  18. xxxxxx
  19. Programmer Information
  20.     John Neil
  21. February 10, 1995
  22. What SoftwareFPU Does
  23. YSoftwareFPU is a control panel which emulates a Motorola 68881 Floating Point Unit (FPU).
  24. )\It is intended to be used in any 68020, 68030, or 68LC040 Macintosh computer without an FPU.
  25. ^It can also be used on Power Macintosh machines, since the Apple 68K emulator does not emulate
  26. _FPU instructions.  It works by patching out the F-Line exception vector of the machine with one
  27. 1that points to FPU emulation code in SoftwareFPU.
  28. /Differences Between a 68881 FPU and SoftwareFPU
  29. RThe differences between the hardware FPU and SoftwareFPU are minimal.  The current
  30. )7differences between SoftwareFPU and a hardware FPU are:
  31. /FRESTORE does not support the busy state frame.
  32. Mid-instruction exceptio
  33. )s/ns are reported as post-instruction exceptions.
  34. ZIf an exception occurs in trace mode, two instructions will execute before control returns
  35. to the debugger.
  36. TCode which puts data below the stack pointer and then issues an FPU instruction will
  37. Xnot work.  This is of course a no-no since data below the stack pointer can be clobbered
  38. by interrupt routines as well.
  39. OSome emulated FPU instructions may produce slightly different results than on a
  40. hardware FPU.
  41. ;YIn addition, on PowerPC machines in 64-bit accuracy mode the following differences exist:
  42. UThe rounding precision in the FPU Mode Control Byte is ignored.  All calculations are
  43. Pperformed as if double-precision rounding was selected in the Mode Control Byte.
  44. SFor performance reasons, the PowerPC emulator cannot emulate address and bus errors
  45. Xproperly.  If an FPU instruction causes an address or bus error, the emulator will break
  46. Pinto MacsBug at a location inside the emulator, rather than at the offending FPU
  47. instruction.
  48. ;<The current list of known application incompatibilities are:
  49. IAny program which replaces the F-line exception vector will not work with
  50. RSoftwareFPU.  A typical example is a source-level debugger in a development system
  51. Mlike MPW or THINK C/Symantec C++.  SoftwareFPU 3.0 provides a new facility so
  52. Xapplications like this can detect whether SoftwareFPU is installed, to determine whether
  53. Bor not the F-Line exception vector should be replaced (see below).
  54. Times
  55. QA bug in the MPW 3.1 nan() function means that any program calling nan() will not
  56. Swork.  Because of this, the MPW functions atan2(), asin(), and acos() will not work
  57. Twhen they try to  produce QNANs.  Also, fscanf will not read in NANs correctly.  The
  58. bug has been fixed in MPW 3.2.
  59. MCode which assumes that calls to SANE affect the FPU will  not work.  The MPW
  60. [functions sinh() and cosh() may produce incorrect results in the exception status register,
  61. *as the library code makes this assumption.
  62. SCode that depends on 68882 or 68040 FPU stack frames or instructions will not work.
  63. FSoftwareFPU currently only emulates a 68881 FPU, even on 68LC040 CPUs.
  64. VApplications that depend upon a particular FPU should verify the type of FPU installed
  65.     with the 
  66. Courier
  67. gestaltFPUType
  68.  Gestalt selector.
  69. Performance
  70. _Because of the overhead in emulating all the intricacies of the FPU, executing FPU instructions
  71. )Rthrough SoftwareFPU is slower than calling SANE.  SoftwareFPU is aware of existing
  72. [applications that can switch between hardware or software floating-point (such as Microsoft
  73. SExcel), and does not report the presence of an FPU, so they will not slow down with
  74. bSoftwareFPU installed.  However, if you are writing a new application with this functionality, you
  75. \should check whether SoftwareFPU is installed using the new facility in SoftwareFPU 3.0 (see
  76. 0below) before selecting hardware floating point.
  77. %Detecting the Presence of SoftwareFPU
  78. YSoftwareFPU adds a new Gestalt selector when it is installed in the system.  To determine
  79. )Iwhether SoftwareFPU is installed, simply make the following Gestalt call:
  80. long 
  81.     response;
  82. result 
  83. estalt(
  84. &response);
  85. If the result of the call is 
  86. noErr
  87. ;, then SoftwareFPU is installed, and the 68881 FPU reported
  88. by the 
  89. gestaltFPUType
  90. )TD selector is an emulated FPU.  The value returned in the response is
  91. )9private to John Neil & Associates, and should be ignored.
  92. 68LC040 CPU Chip Bug
  93. MThe 68LC040 chip bug mentioned in the user documentation is that with certain
  94. )Xinstructions streams, pending CPU writes to memory never arrive when an F-Line exception
  95. ^occurs.  Most Macintosh applications are not affected by the bug, since an F-Line exception is
  96. Vnormally a fatal error.   However, software that depends on F-Line exceptions, such as
  97. WSoftwareFPU, will not work properly.  There is no known work-around for the bug once an
  98. Zexception has occurred (the only possible work-around that SoftwareFPU could use).  At the
  99. dapplication level, putting a NOP in front of every F-Line instruction will eliminate the problem, at
  100. [the expense of reducing performance on machines with hardware FPUs.  Despite this bug, some
  101. [FPU applications still work with SoftwareFPU on 68LC040 machines, because their instruction
  102. Ystreams do not trigger the bug.  For more information on the bug, please contact Motorola
  103. Semiconductor Inc.
  104. *6(@4
  105. =8 >+'
  106. /    .#+
  107.     temp.0001
  108. g,YO0.
  109. John M. Neil
  110. John M. Neil
  111. Microsoft Word
  112. Times
  113. Courier
  114. rPREC
  115. ~PRVS
  116.